import service from "@/utils/axios/service.js";
import {config} from "@/utils/axios/config.js";

const request = options => {
    const {url, method, data, params, ContentType} = options;
    return service({
        url,
        method,
        params,
        data,
        headers: {
            'Content-Type': ContentType || config.defaultHeaders
        }
    })
}


export default {
    get: async (option) => {
        const res = await request({method: "GET", ...option})
        return res.data;
    },
    post: async (option) => {
        const res = await request({method: "POST", ...option})
        return res.data;
    }
}